package com.lx.demo.sync.executor;

import com.google.common.collect.Lists;
import com.lx.demo.constans.ExtDataEsInxConstant;

import java.util.List;

/**
 * @author wcy
 */
public class ExtConfiguration {

    private ExtConfiguration() {
    }

    private static final List<String> FAST_LIST = Lists.newArrayList(
            ExtDataEsInxConstant.DRUG_ES_IDX_NAME,
            ExtDataEsInxConstant.MCS_PROD_IDX_NAME,
            ExtDataEsInxConstant.ENTP_IDX_NAME);

    public static SyncExecutor newSyncExecutor(ExtSyncAbstract extSyncAbstract) {
        SyncExecutor syncExecutor;
        if (FAST_LIST.contains(extSyncAbstract.getIdxName())) {
            syncExecutor = new FastSyncExecutor(extSyncAbstract);
        } else {
            syncExecutor = new SimpleSyncExecutor(extSyncAbstract);
        }
        return syncExecutor;
    }
}
